{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "collapsed_sections": [
        "zkufh760uvF3"
      ]
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zkufh760uvF3"
      },
      "source": [
        "![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png)\n",
        "\n",
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/colab/Training/binary_text_classification/NLU_training_sentiment_classifier_demo_natural_disasters.ipynb)\n",
        "\n",
        "\n",
        "# Training a Sentiment Analysis Classifier with NLU\n",
        "## 2 Class Natural Disasters Sentiment Classifer Training\n",
        "With the [SentimentDL model](https://nlp.johnsnowlabs.com/docs/en/annotators#sentimentdl-multi-class-sentiment-analysis-annotator)  from Spark NLP you can achieve State Of the Art results on any multi class text classification problem\n",
        "\n",
        "This notebook showcases the following features :\n",
        "\n",
        "- How to train the deep learning classifier\n",
        "- How to store a pipeline to disk\n",
        "- How to load the pipeline from disk (Enables NLU offline mode)\n",
        "\n",
        "You can achieve these results or even better on this dataset with training data:\n",
        "\n",
        "\n",
        "<br>\n",
        "\n",
        "![image.png]()\n",
        "\n",
        "You can achieve these results or even better on this dataset with test  data:\n",
        "\n",
        "\n",
        "<br>\n",
        "\n",
        "\n",
        "![Screenshot 2021-02-25 142700.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "dur2drhW5Rvi"
      },
      "source": [
        "# 1. Install Java 8 and NLU"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hFGnBCHavltY"
      },
      "source": [
        "!pip install -q johnsnowlabs"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "f4KkTfnR5Ugg"
      },
      "source": [
        "# 2. Download Disaster  Sentiment dataset\n",
        "https://www.kaggle.com/vstepanenko/disaster-tweets\n",
        "#Context\n",
        "\n",
        "The file contains over 11,000 tweets associated with disaster keywords like “crash”, “quarantine”, and “bush fires” as well as the location and keyword itself. The data structure was inherited from Disasters on social media\n",
        "\n",
        "The tweets were collected on Jan 14th, 2020.\n",
        "\n",
        "Some of the topics people were tweeting:\n",
        "\n",
        "The eruption of Taal Volcano in Batangas, Philippines\n",
        "Coronavirus\n",
        "Bushfires in Australia\n",
        "Iran downing of the airplane flight PS752\n",
        "Disclaimer: The dataset contains text that may be considered profane, vulgar, or offensive."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "OrVb5ZMvvrQD",
        "outputId": "aae15220-50fe-4645-9720-2b2e368f049b"
      },
      "source": [
        "! wget https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/resources/en/classifier-dl/disaster_tweets/tweets.csv\n"
      ],
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "--2023-11-03 13:51:47--  https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/resources/en/classifier-dl/disaster_tweets/tweets.csv\n",
            "Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.197.160, 52.217.86.86, 52.217.175.88, ...\n",
            "Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.197.160|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 1615005 (1.5M) [text/csv]\n",
            "Saving to: ‘tweets.csv’\n",
            "\n",
            "tweets.csv          100%[===================>]   1.54M  3.54MB/s    in 0.4s    \n",
            "\n",
            "2023-11-03 13:51:48 (3.54 MB/s) - ‘tweets.csv’ saved [1615005/1615005]\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "train_df"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 424
        },
        "id": "3Fu5MWAddMSF",
        "outputId": "e4c88301-1f62-419f-8990-83340362379d"
      },
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "       ï»¿id  keyword                 location  \\\n",
              "2          2   ablaze            New York City   \n",
              "3          3   ablaze           Morgantown, WV   \n",
              "5          5   ablaze                       OC   \n",
              "6          6   ablaze          London, England   \n",
              "7          7   ablaze                   Bharat   \n",
              "...      ...      ...                      ...   \n",
              "11362  11362  wrecked        feuille d'Ã©rable   \n",
              "11365  11365  wrecked  Blue State in a red sea   \n",
              "11366  11366  wrecked               arohaonces   \n",
              "11367  11367  wrecked                 ðµð­   \n",
              "11368  11368  wrecked           auroraborealis   \n",
              "\n",
              "                                                    text  target  \n",
              "2      Arsonist sets cars ablaze at dealership https:...       1  \n",
              "3      Arsonist sets cars ablaze at dealership https:...       1  \n",
              "5      If this child was Chinese, this tweet would ha...       0  \n",
              "6      Several houses have been set ablaze in Ngemsib...       1  \n",
              "7      Asansol: A BJP office in Salanpur village was ...       1  \n",
              "...                                                  ...     ...  \n",
              "11362  Stell wrecked ako palagi sayo. Haha. #ALABTopS...       0  \n",
              "11365  Media should have warned us well in advance. T...       0  \n",
              "11366  i feel directly attacked ð i consider moonb...       0  \n",
              "11367  i feel directly attacked ð i consider moonb...       0  \n",
              "11368  ok who remember \"outcast\" nd the \"dora\" au?? T...       0  \n",
              "\n",
              "[7952 rows x 5 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-b7264507-12e8-4d4d-96d8-1a7b22a908c6\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>ï»¿id</th>\n",
              "      <th>keyword</th>\n",
              "      <th>location</th>\n",
              "      <th>text</th>\n",
              "      <th>target</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>2</td>\n",
              "      <td>ablaze</td>\n",
              "      <td>New York City</td>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>3</td>\n",
              "      <td>ablaze</td>\n",
              "      <td>Morgantown, WV</td>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>5</td>\n",
              "      <td>ablaze</td>\n",
              "      <td>OC</td>\n",
              "      <td>If this child was Chinese, this tweet would ha...</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>6</td>\n",
              "      <td>ablaze</td>\n",
              "      <td>London, England</td>\n",
              "      <td>Several houses have been set ablaze in Ngemsib...</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>7</td>\n",
              "      <td>ablaze</td>\n",
              "      <td>Bharat</td>\n",
              "      <td>Asansol: A BJP office in Salanpur village was ...</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11362</th>\n",
              "      <td>11362</td>\n",
              "      <td>wrecked</td>\n",
              "      <td>feuille d'Ã©rable</td>\n",
              "      <td>Stell wrecked ako palagi sayo. Haha. #ALABTopS...</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11365</th>\n",
              "      <td>11365</td>\n",
              "      <td>wrecked</td>\n",
              "      <td>Blue State in a red sea</td>\n",
              "      <td>Media should have warned us well in advance. T...</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11366</th>\n",
              "      <td>11366</td>\n",
              "      <td>wrecked</td>\n",
              "      <td>arohaonces</td>\n",
              "      <td>i feel directly attacked ð i consider moonb...</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11367</th>\n",
              "      <td>11367</td>\n",
              "      <td>wrecked</td>\n",
              "      <td>ðµð­</td>\n",
              "      <td>i feel directly attacked ð i consider moonb...</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11368</th>\n",
              "      <td>11368</td>\n",
              "      <td>wrecked</td>\n",
              "      <td>auroraborealis</td>\n",
              "      <td>ok who remember \"outcast\" nd the \"dora\" au?? T...</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>7952 rows × 5 columns</p>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b7264507-12e8-4d4d-96d8-1a7b22a908c6')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-b7264507-12e8-4d4d-96d8-1a7b22a908c6 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-b7264507-12e8-4d4d-96d8-1a7b22a908c6');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-72b8a439-95f0-487f-b01b-c2430bbbafee\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-72b8a439-95f0-487f-b01b-c2430bbbafee')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-72b8a439-95f0-487f-b01b-c2430bbbafee button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 458
        },
        "id": "y4xSRWIhwT28",
        "outputId": "d01f0b51-19d4-4d9c-f22d-4897c6b2bd20"
      },
      "source": [
        "import pandas as pd\n",
        "train_path = '/content/tweets.csv'\n",
        "\n",
        "train_df = pd.read_csv(train_path,sep=\",\", encoding='latin-1')\n",
        "train_df.rename(columns={'target': 'y'}, inplace=True)\n",
        "\n",
        "# the text data to use for classification should be in a column named 'text'\n",
        "columns=['text','y']\n",
        "train_df = train_df.dropna()\n",
        "\n",
        "train_df = train_df[columns]\n",
        "train_df = train_df[~train_df[\"y\"].isin([\"neutral\"])]\n",
        "train_df['y'] = train_df['y'].replace({0: 'negative', 1: 'positive'})\n",
        "\n",
        "positive = train_df[train_df['y']==(\"positive\")].iloc[:1500]\n",
        "negative = train_df[train_df['y']==(\"negative\")].iloc[:1500]\n",
        "positive = positive.append(negative, ignore_index = True)\n",
        "positive = positive.sample(frac=1).reset_index(drop=True)\n",
        "train_df = positive\n",
        "\n",
        "from sklearn.model_selection import train_test_split\n",
        "\n",
        "train_df, test_df = train_test_split(train_df, test_size=0.2)\n",
        "train_df\n"
      ],
      "execution_count": 19,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-19-bf4997bed616>:17: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
            "  positive = positive.append(negative, ignore_index = True)\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                   text         y\n",
              "1786  Arsonist sets cars ablaze at dealership https:...  positive\n",
              "2465  Travis Manawa [about Brandon's group]: I think...  negative\n",
              "1318  If a scientist said if you jump off a cliff yo...  negative\n",
              "2177  #StormBrendon is also bringing high winds, so ...  positive\n",
              "293   Like , I'm really talking about blending gener...  negative\n",
              "...                                                 ...       ...\n",
              "666   US Troops Clear Rubble from Iraq Base Days Aft...  positive\n",
              "2843     can we create an anti-bioterrorism commission?  negative\n",
              "312   When cultures collide! #southernspain https://...  negative\n",
              "2072  A look inside a tree that has been struck by l...  positive\n",
              "2024  Two lanes have been closed while emergency ser...  positive\n",
              "\n",
              "[2400 rows x 2 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-e2ffdca7-0499-44f2-877c-555301876e13\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>1786</th>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2465</th>\n",
              "      <td>Travis Manawa [about Brandon's group]: I think...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1318</th>\n",
              "      <td>If a scientist said if you jump off a cliff yo...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2177</th>\n",
              "      <td>#StormBrendon is also bringing high winds, so ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>293</th>\n",
              "      <td>Like , I'm really talking about blending gener...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>666</th>\n",
              "      <td>US Troops Clear Rubble from Iraq Base Days Aft...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2843</th>\n",
              "      <td>can we create an anti-bioterrorism commission?</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>312</th>\n",
              "      <td>When cultures collide! #southernspain https://...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2072</th>\n",
              "      <td>A look inside a tree that has been struck by l...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2024</th>\n",
              "      <td>Two lanes have been closed while emergency ser...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>2400 rows × 2 columns</p>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-e2ffdca7-0499-44f2-877c-555301876e13')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-e2ffdca7-0499-44f2-877c-555301876e13 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-e2ffdca7-0499-44f2-877c-555301876e13');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-030dc6fc-684d-4d7a-aab4-af37945281cd\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-030dc6fc-684d-4d7a-aab4-af37945281cd')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-030dc6fc-684d-4d7a-aab4-af37945281cd button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 19
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0296Om2C5anY"
      },
      "source": [
        "# 3. Train Deep Learning Classifier using nlu.load('train.sentiment')\n",
        "\n",
        "You dataset label column should be named 'y' and the feature column with text data should be named 'text'"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "3ZIPkRkWftBG",
        "outputId": "3e5f0825-bfd1-402a-e273-5e1656753bd9"
      },
      "source": [
        "from johnsnowlabs import nlp\n",
        "from sklearn.metrics import classification_report\n",
        "# load a trainable pipeline by specifying the train. prefix  and fit it on a datset with label and text columns\n",
        "# by default the Universal Sentence Encoder (USE) Sentence embeddings are used for generation\n",
        "trainable_pipe = nlp.load('train.sentiment')\n",
        "fitted_pipe = trainable_pipe.fit(train_df.iloc[:50])\n",
        "\n",
        "# predict with the trainable pipeline on dataset and get predictions\n",
        "preds = fitted_pipe.predict(train_df.iloc[:50],output_level='document')\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))\n",
        "\n",
        "preds"
      ],
      "execution_count": 20,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "sent_small_bert_L2_128 download started this may take some time.\n",
            "Approximate size to download 16.1 MB\n",
            "[OK!]\n",
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.56      1.00      0.72        28\n",
            "    positive       0.00      0.00      0.00        22\n",
            "\n",
            "    accuracy                           0.56        50\n",
            "   macro avg       0.28      0.50      0.36        50\n",
            "weighted avg       0.31      0.56      0.40        50\n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                             document  \\\n",
              "0   Arsonist sets cars ablaze at dealership https:...   \n",
              "1   Travis Manawa [about Brandon's group]: I think...   \n",
              "2   If a scientist said if you jump off a cliff yo...   \n",
              "3   #StormBrendon is also bringing high winds, so ...   \n",
              "4   Like , I'm really talking about blending gener...   \n",
              "5   Seriously though... If that defender was taken...   \n",
              "6   Chemical Hazard - Advice for Cobram. For more ...   \n",
              "7   2,400 jobs are at stake should the deal fall t...   \n",
              "8   Western Cape blood stocks down to just four da...   \n",
              "9   Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...   \n",
              "10  BREAKING: Ukrainian President Volodymyr Zelens...   \n",
              "11  Here's what you can learn from the conservativ...   \n",
              "12  Rajneeti News (Stardust: Oldest material on ea...   \n",
              "13  In 2008, Laskar and Gastineau simulated 2500 f...   \n",
              "14  Why are you still calling it a plane crash ð§...   \n",
              "15  Report recieved of a 9 vehicle RTC on M66 betw...   \n",
              "16  ** Cleared ** The vehicles involved in the col...   \n",
              "17  105 is the number to call if you have a power ...   \n",
              "18  Stress is something that affects many of us. I...   \n",
              "19  Re: #AustraliaBushfires, a question for any #f...   \n",
              "20  Enormous exploding sinkhole in China swallows ...   \n",
              "21  This creature whoâs soul is no longer claren...   \n",
              "22  In 70 CE Titus the son of the Roman Emperor Ve...   \n",
              "23  #BREAKING: Trudeau says the 57 Canadians kille...   \n",
              "24  airplane accident answers. The US designated t...   \n",
              "25  Unlike previous State of the nation addresses,...   \n",
              "26  Woodbury takes emergency action to address #wa...   \n",
              "27  Mudslide closes Kailua-bound lane of Pali High...   \n",
              "28  á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...   \n",
              "29  Eduardo Degrano looks at the damage to his hom...   \n",
              "30  darinde...how i wish i could put these in hot ...   \n",
              "31  Earthquake Information No.1 Date and Time: 14 ...   \n",
              "32  âItâs a blight on the country as a whole.â...   \n",
              "33  I don't mind being your enemy if you're an ene...   \n",
              "34  A follow-up to yesterday's Pakistan post: In t...   \n",
              "35  âPassed away.â This euphemistic trash is p...   \n",
              "36  I wonder how many homes could have been saved ...   \n",
              "37  I just zoom it and took ss and feel attack.. H...   \n",
              "38  Human Body Parts Discovered In Bag In Dublin h...   \n",
              "39  It is not just an Australian problem. We need ...   \n",
              "40  If I didn't need my Crutch I would seriously w...   \n",
              "41  But it eventually will have to work without......   \n",
              "42  ... #MAGA5G.LiVEViL+ my recommended read not f...   \n",
              "43  This earlier collision N'bound between J9 Red ...   \n",
              "44           I feel attacked. https://t.co/PrtvRimq6y   \n",
              "45  For the past several months, after imposing a ...   \n",
              "46  Yuck! Looks like she's wearing a body bag. May...   \n",
              "47  Such a loss to and the people of NE Fife. pays...   \n",
              "48          This rain going dumb, itâs flooding now   \n",
              "49  WEATHER ALERT: Severe Thunderstorm Warning inc...   \n",
              "\n",
              "                 sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0   [-0.1667916625738144, 1.0302923917770386, 0.18...  negative   \n",
              "1   [-0.9610550999641418, 0.13062980771064758, -0....  negative   \n",
              "2   [-0.6688402891159058, 0.640354335308075, 0.369...  negative   \n",
              "3   [-1.0540131330490112, 0.8802893757820129, -0.6...  negative   \n",
              "4   [-1.0963889360427856, -0.39644378423690796, 0....  negative   \n",
              "5   [-0.9136804938316345, 0.593141496181488, -0.13...  negative   \n",
              "6   [-0.38091930747032166, 0.6411349177360535, 0.1...  negative   \n",
              "7   [-0.44847720861434937, 0.5910513997077942, -0....  negative   \n",
              "8   [-0.5973049402236938, 0.3307306170463562, -0.1...  negative   \n",
              "9   [-0.5309799313545227, -0.5059896111488342, -0....  negative   \n",
              "10  [-1.1355115175247192, -0.24506860971450806, -0...  negative   \n",
              "11  [-1.1318162679672241, 0.4271548390388489, -0.1...  negative   \n",
              "12  [-0.4446831941604614, -0.11513718217611313, 0....  negative   \n",
              "13  [-0.7734904885292053, -0.19835318624973297, -0...  negative   \n",
              "14  [-0.12437181919813156, 1.112841010093689, 0.27...  negative   \n",
              "15  [-0.38135823607444763, 1.1142768859863281, -0....  negative   \n",
              "16  [-0.2368348389863968, 0.9701917171478271, -0.3...  negative   \n",
              "17  [-0.8241100907325745, 1.1454272270202637, -0.0...  negative   \n",
              "18  [-0.9658268690109253, 0.5662633776664734, -0.2...  negative   \n",
              "19  [-0.6997240781784058, 0.5168095827102661, 0.12...  negative   \n",
              "20  [-0.5793707370758057, -0.18351595103740692, -0...  negative   \n",
              "21  [-0.4663412868976593, 0.04406387358903885, 0.1...  negative   \n",
              "22  [-0.8847564458847046, -0.1676793396472931, -0....  negative   \n",
              "23  [-0.45176926255226135, -0.1339559406042099, -0...  negative   \n",
              "24  [-0.2922760844230652, 0.3953195810317993, -0.1...  negative   \n",
              "25  [-0.8965665698051453, 0.9926007986068726, -0.3...  negative   \n",
              "26  [-0.7830190658569336, 0.8649871349334717, 0.20...  negative   \n",
              "27  [-0.42747634649276733, 0.13894236087799072, -0...  negative   \n",
              "28  [-0.5791727304458618, 0.11972904205322266, 0.4...  negative   \n",
              "29  [-1.1623308658599854, 0.569926917552948, -0.58...  negative   \n",
              "30  [-1.5163923501968384, 0.6165133118629456, -0.5...  negative   \n",
              "31  [-1.085410714149475, -0.15019290149211884, -0....  negative   \n",
              "32  [-0.5412101745605469, 0.611747682094574, -0.00...  negative   \n",
              "33  [-0.6546711325645447, 0.43016937375068665, -0....  negative   \n",
              "34  [-1.091268539428711, -0.17232197523117065, -0....  negative   \n",
              "35  [-1.0350548028945923, 0.04470200464129448, -0....  negative   \n",
              "36  [-0.6520278453826904, 0.6858862042427063, -0.3...  negative   \n",
              "37  [-0.9297969937324524, -0.12180554866790771, 0....  negative   \n",
              "38  [-0.6394882202148438, 0.8264853954315186, 0.34...  negative   \n",
              "39  [-0.7464641332626343, 0.9418659806251526, -0.3...  negative   \n",
              "40  [-1.1001498699188232, 1.0316743850708008, -0.3...  negative   \n",
              "41  [-0.6016444563865662, 0.95436030626297, -0.232...  negative   \n",
              "42  [-0.8835289478302002, 0.3090209364891052, 0.29...  negative   \n",
              "43  [-0.19473275542259216, 0.8363125920295715, 0.0...  negative   \n",
              "44  [-0.4955633580684662, 0.16522228717803955, 0.6...  negative   \n",
              "45  [-0.5843112468719482, 0.04129549860954285, 0.2...  negative   \n",
              "46  [-1.058443307876587, 0.23154138028621674, -0.4...  negative   \n",
              "47  [-0.9249093532562256, -0.045939963310956955, -...  negative   \n",
              "48  [-1.7112693786621094, 0.5982310175895691, -0.2...  negative   \n",
              "49  [-0.7861663699150085, 0.22981716692447662, -0....  negative   \n",
              "\n",
              "   sentiment_confidence                                               text  \\\n",
              "0                   8.0  Arsonist sets cars ablaze at dealership https:...   \n",
              "1                   2.0  Travis Manawa [about Brandon's group]: I think...   \n",
              "2                   3.0  If a scientist said if you jump off a cliff yo...   \n",
              "3                   4.0  #StormBrendon is also bringing high winds, so ...   \n",
              "4                   1.0  Like , I'm really talking about blending gener...   \n",
              "5                   4.0  Seriously though... If that defender was taken...   \n",
              "6                   3.0  Chemical Hazard - Advice for Cobram. For more ...   \n",
              "7                   5.0  2,400 jobs are at stake should the deal fall t...   \n",
              "8                   8.0  Western Cape blood stocks down to just four da...   \n",
              "9                   0.0  Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...   \n",
              "10                  0.0  BREAKING: Ukrainian President Volodymyr Zelens...   \n",
              "11                  3.0  Here's what you can learn from the conservativ...   \n",
              "12                  0.0  Rajneeti News (Stardust: Oldest material on ea...   \n",
              "13                  8.0  In 2008, Laskar and Gastineau simulated 2500 f...   \n",
              "14                  2.0  Why are you still calling it a plane crash ð§...   \n",
              "15                  0.0  Report recieved of a 9 vehicle RTC on M66 betw...   \n",
              "16                  0.0  ** Cleared ** The vehicles involved in the col...   \n",
              "17                  3.0  105 is the number to call if you have a power ...   \n",
              "18                  6.0  Stress is something that affects many of us. I...   \n",
              "19                  5.0  Re: #AustraliaBushfires, a question for any #f...   \n",
              "20                  9.0  Enormous exploding sinkhole in China swallows ...   \n",
              "21                  3.0  This creature whoâs soul is no longer claren...   \n",
              "22                  9.0  In 70 CE Titus the son of the Roman Emperor Ve...   \n",
              "23                  0.0  #BREAKING: Trudeau says the 57 Canadians kille...   \n",
              "24                  5.0  airplane accident answers. The US designated t...   \n",
              "25                  4.0  Unlike previous State of the nation addresses,...   \n",
              "26                  7.0  Woodbury takes emergency action to address #wa...   \n",
              "27                  0.0  Mudslide closes Kailua-bound lane of Pali High...   \n",
              "28                  9.0  á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...   \n",
              "29                  2.0  Eduardo Degrano looks at the damage to his hom...   \n",
              "30                  1.0  darinde...how i wish i could put these in hot ...   \n",
              "31                  0.0  Earthquake Information No.1 Date and Time: 14 ...   \n",
              "32                  4.0  âItâs a blight on the country as a whole.â...   \n",
              "33                  1.0  I don't mind being your enemy if you're an ene...   \n",
              "34                  9.0  A follow-up to yesterday's Pakistan post: In t...   \n",
              "35                  3.0  âPassed away.â This euphemistic trash is p...   \n",
              "36                  3.0  I wonder how many homes could have been saved ...   \n",
              "37                  2.0  I just zoom it and took ss and feel attack.. H...   \n",
              "38                  6.0  Human Body Parts Discovered In Bag In Dublin h...   \n",
              "39                  5.0  It is not just an Australian problem. We need ...   \n",
              "40                  2.0  If I didn't need my Crutch I would seriously w...   \n",
              "41                  2.0  But it eventually will have to work without......   \n",
              "42                  2.0  ... #MAGA5G.LiVEViL+ my recommended read not f...   \n",
              "43                  8.0  This earlier collision N'bound between J9 Red ...   \n",
              "44                  2.0           I feel attacked. https://t.co/PrtvRimq6y   \n",
              "45                  8.0  For the past several months, after imposing a ...   \n",
              "46                  1.0  Yuck! Looks like she's wearing a body bag. May...   \n",
              "47                  1.0  Such a loss to and the people of NE Fife. pays...   \n",
              "48                  2.0          This rain going dumb, itâs flooding now   \n",
              "49                  0.0  WEATHER ALERT: Severe Thunderstorm Warning inc...   \n",
              "\n",
              "           y  \n",
              "0   positive  \n",
              "1   negative  \n",
              "2   negative  \n",
              "3   positive  \n",
              "4   negative  \n",
              "5   positive  \n",
              "6   positive  \n",
              "7   negative  \n",
              "8   negative  \n",
              "9   positive  \n",
              "10  positive  \n",
              "11  negative  \n",
              "12  negative  \n",
              "13  negative  \n",
              "14  negative  \n",
              "15  positive  \n",
              "16  positive  \n",
              "17  positive  \n",
              "18  negative  \n",
              "19  negative  \n",
              "20  positive  \n",
              "21  negative  \n",
              "22  positive  \n",
              "23  positive  \n",
              "24  negative  \n",
              "25  negative  \n",
              "26  positive  \n",
              "27  positive  \n",
              "28  negative  \n",
              "29  negative  \n",
              "30  negative  \n",
              "31  positive  \n",
              "32  negative  \n",
              "33  negative  \n",
              "34  positive  \n",
              "35  negative  \n",
              "36  negative  \n",
              "37  negative  \n",
              "38  positive  \n",
              "39  negative  \n",
              "40  positive  \n",
              "41  negative  \n",
              "42  negative  \n",
              "43  positive  \n",
              "44  negative  \n",
              "45  positive  \n",
              "46  negative  \n",
              "47  negative  \n",
              "48  positive  \n",
              "49  positive  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-abb9fedd-6897-4672-ad89-18bc9882cda0\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>[-0.1667916625738144, 1.0302923917770386, 0.18...</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Travis Manawa [about Brandon's group]: I think...</td>\n",
              "      <td>[-0.9610550999641418, 0.13062980771064758, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Travis Manawa [about Brandon's group]: I think...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>If a scientist said if you jump off a cliff yo...</td>\n",
              "      <td>[-0.6688402891159058, 0.640354335308075, 0.369...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>If a scientist said if you jump off a cliff yo...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>#StormBrendon is also bringing high winds, so ...</td>\n",
              "      <td>[-1.0540131330490112, 0.8802893757820129, -0.6...</td>\n",
              "      <td>negative</td>\n",
              "      <td>4.0</td>\n",
              "      <td>#StormBrendon is also bringing high winds, so ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Like , I'm really talking about blending gener...</td>\n",
              "      <td>[-1.0963889360427856, -0.39644378423690796, 0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Like , I'm really talking about blending gener...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>Seriously though... If that defender was taken...</td>\n",
              "      <td>[-0.9136804938316345, 0.593141496181488, -0.13...</td>\n",
              "      <td>negative</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Seriously though... If that defender was taken...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>Chemical Hazard - Advice for Cobram. For more ...</td>\n",
              "      <td>[-0.38091930747032166, 0.6411349177360535, 0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Chemical Hazard - Advice for Cobram. For more ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>2,400 jobs are at stake should the deal fall t...</td>\n",
              "      <td>[-0.44847720861434937, 0.5910513997077942, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>2,400 jobs are at stake should the deal fall t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>Western Cape blood stocks down to just four da...</td>\n",
              "      <td>[-0.5973049402236938, 0.3307306170463562, -0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>Western Cape blood stocks down to just four da...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...</td>\n",
              "      <td>[-0.5309799313545227, -0.5059896111488342, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>10</th>\n",
              "      <td>BREAKING: Ukrainian President Volodymyr Zelens...</td>\n",
              "      <td>[-1.1355115175247192, -0.24506860971450806, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>BREAKING: Ukrainian President Volodymyr Zelens...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11</th>\n",
              "      <td>Here's what you can learn from the conservativ...</td>\n",
              "      <td>[-1.1318162679672241, 0.4271548390388489, -0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Here's what you can learn from the conservativ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12</th>\n",
              "      <td>Rajneeti News (Stardust: Oldest material on ea...</td>\n",
              "      <td>[-0.4446831941604614, -0.11513718217611313, 0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Rajneeti News (Stardust: Oldest material on ea...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>13</th>\n",
              "      <td>In 2008, Laskar and Gastineau simulated 2500 f...</td>\n",
              "      <td>[-0.7734904885292053, -0.19835318624973297, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>In 2008, Laskar and Gastineau simulated 2500 f...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14</th>\n",
              "      <td>Why are you still calling it a plane crash ð§...</td>\n",
              "      <td>[-0.12437181919813156, 1.112841010093689, 0.27...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Why are you still calling it a plane crash ð§...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>15</th>\n",
              "      <td>Report recieved of a 9 vehicle RTC on M66 betw...</td>\n",
              "      <td>[-0.38135823607444763, 1.1142768859863281, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Report recieved of a 9 vehicle RTC on M66 betw...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>16</th>\n",
              "      <td>** Cleared ** The vehicles involved in the col...</td>\n",
              "      <td>[-0.2368348389863968, 0.9701917171478271, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>** Cleared ** The vehicles involved in the col...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>17</th>\n",
              "      <td>105 is the number to call if you have a power ...</td>\n",
              "      <td>[-0.8241100907325745, 1.1454272270202637, -0.0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>105 is the number to call if you have a power ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>18</th>\n",
              "      <td>Stress is something that affects many of us. I...</td>\n",
              "      <td>[-0.9658268690109253, 0.5662633776664734, -0.2...</td>\n",
              "      <td>negative</td>\n",
              "      <td>6.0</td>\n",
              "      <td>Stress is something that affects many of us. I...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19</th>\n",
              "      <td>Re: #AustraliaBushfires, a question for any #f...</td>\n",
              "      <td>[-0.6997240781784058, 0.5168095827102661, 0.12...</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Re: #AustraliaBushfires, a question for any #f...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>20</th>\n",
              "      <td>Enormous exploding sinkhole in China swallows ...</td>\n",
              "      <td>[-0.5793707370758057, -0.18351595103740692, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>9.0</td>\n",
              "      <td>Enormous exploding sinkhole in China swallows ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>21</th>\n",
              "      <td>This creature whoâs soul is no longer claren...</td>\n",
              "      <td>[-0.4663412868976593, 0.04406387358903885, 0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>This creature whoâs soul is no longer claren...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>22</th>\n",
              "      <td>In 70 CE Titus the son of the Roman Emperor Ve...</td>\n",
              "      <td>[-0.8847564458847046, -0.1676793396472931, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>9.0</td>\n",
              "      <td>In 70 CE Titus the son of the Roman Emperor Ve...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>23</th>\n",
              "      <td>#BREAKING: Trudeau says the 57 Canadians kille...</td>\n",
              "      <td>[-0.45176926255226135, -0.1339559406042099, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>#BREAKING: Trudeau says the 57 Canadians kille...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>24</th>\n",
              "      <td>airplane accident answers. The US designated t...</td>\n",
              "      <td>[-0.2922760844230652, 0.3953195810317993, -0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>airplane accident answers. The US designated t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>25</th>\n",
              "      <td>Unlike previous State of the nation addresses,...</td>\n",
              "      <td>[-0.8965665698051453, 0.9926007986068726, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Unlike previous State of the nation addresses,...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>26</th>\n",
              "      <td>Woodbury takes emergency action to address #wa...</td>\n",
              "      <td>[-0.7830190658569336, 0.8649871349334717, 0.20...</td>\n",
              "      <td>negative</td>\n",
              "      <td>7.0</td>\n",
              "      <td>Woodbury takes emergency action to address #wa...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>27</th>\n",
              "      <td>Mudslide closes Kailua-bound lane of Pali High...</td>\n",
              "      <td>[-0.42747634649276733, 0.13894236087799072, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Mudslide closes Kailua-bound lane of Pali High...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>28</th>\n",
              "      <td>á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...</td>\n",
              "      <td>[-0.5791727304458618, 0.11972904205322266, 0.4...</td>\n",
              "      <td>negative</td>\n",
              "      <td>9.0</td>\n",
              "      <td>á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>29</th>\n",
              "      <td>Eduardo Degrano looks at the damage to his hom...</td>\n",
              "      <td>[-1.1623308658599854, 0.569926917552948, -0.58...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Eduardo Degrano looks at the damage to his hom...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>30</th>\n",
              "      <td>darinde...how i wish i could put these in hot ...</td>\n",
              "      <td>[-1.5163923501968384, 0.6165133118629456, -0.5...</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>darinde...how i wish i could put these in hot ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>31</th>\n",
              "      <td>Earthquake Information No.1 Date and Time: 14 ...</td>\n",
              "      <td>[-1.085410714149475, -0.15019290149211884, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Earthquake Information No.1 Date and Time: 14 ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>32</th>\n",
              "      <td>âItâs a blight on the country as a whole.â...</td>\n",
              "      <td>[-0.5412101745605469, 0.611747682094574, -0.00...</td>\n",
              "      <td>negative</td>\n",
              "      <td>4.0</td>\n",
              "      <td>âItâs a blight on the country as a whole.â...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>33</th>\n",
              "      <td>I don't mind being your enemy if you're an ene...</td>\n",
              "      <td>[-0.6546711325645447, 0.43016937375068665, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>I don't mind being your enemy if you're an ene...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>34</th>\n",
              "      <td>A follow-up to yesterday's Pakistan post: In t...</td>\n",
              "      <td>[-1.091268539428711, -0.17232197523117065, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>9.0</td>\n",
              "      <td>A follow-up to yesterday's Pakistan post: In t...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>35</th>\n",
              "      <td>âPassed away.â This euphemistic trash is p...</td>\n",
              "      <td>[-1.0350548028945923, 0.04470200464129448, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>âPassed away.â This euphemistic trash is p...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>36</th>\n",
              "      <td>I wonder how many homes could have been saved ...</td>\n",
              "      <td>[-0.6520278453826904, 0.6858862042427063, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>I wonder how many homes could have been saved ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>37</th>\n",
              "      <td>I just zoom it and took ss and feel attack.. H...</td>\n",
              "      <td>[-0.9297969937324524, -0.12180554866790771, 0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>I just zoom it and took ss and feel attack.. H...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>38</th>\n",
              "      <td>Human Body Parts Discovered In Bag In Dublin h...</td>\n",
              "      <td>[-0.6394882202148438, 0.8264853954315186, 0.34...</td>\n",
              "      <td>negative</td>\n",
              "      <td>6.0</td>\n",
              "      <td>Human Body Parts Discovered In Bag In Dublin h...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>39</th>\n",
              "      <td>It is not just an Australian problem. We need ...</td>\n",
              "      <td>[-0.7464641332626343, 0.9418659806251526, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>It is not just an Australian problem. We need ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>40</th>\n",
              "      <td>If I didn't need my Crutch I would seriously w...</td>\n",
              "      <td>[-1.1001498699188232, 1.0316743850708008, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>If I didn't need my Crutch I would seriously w...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>41</th>\n",
              "      <td>But it eventually will have to work without......</td>\n",
              "      <td>[-0.6016444563865662, 0.95436030626297, -0.232...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>But it eventually will have to work without......</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>42</th>\n",
              "      <td>... #MAGA5G.LiVEViL+ my recommended read not f...</td>\n",
              "      <td>[-0.8835289478302002, 0.3090209364891052, 0.29...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>... #MAGA5G.LiVEViL+ my recommended read not f...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>43</th>\n",
              "      <td>This earlier collision N'bound between J9 Red ...</td>\n",
              "      <td>[-0.19473275542259216, 0.8363125920295715, 0.0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>This earlier collision N'bound between J9 Red ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>44</th>\n",
              "      <td>I feel attacked. https://t.co/PrtvRimq6y</td>\n",
              "      <td>[-0.4955633580684662, 0.16522228717803955, 0.6...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>I feel attacked. https://t.co/PrtvRimq6y</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>45</th>\n",
              "      <td>For the past several months, after imposing a ...</td>\n",
              "      <td>[-0.5843112468719482, 0.04129549860954285, 0.2...</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>For the past several months, after imposing a ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>46</th>\n",
              "      <td>Yuck! Looks like she's wearing a body bag. May...</td>\n",
              "      <td>[-1.058443307876587, 0.23154138028621674, -0.4...</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Yuck! Looks like she's wearing a body bag. May...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>47</th>\n",
              "      <td>Such a loss to and the people of NE Fife. pays...</td>\n",
              "      <td>[-0.9249093532562256, -0.045939963310956955, -...</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Such a loss to and the people of NE Fife. pays...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>48</th>\n",
              "      <td>This rain going dumb, itâs flooding now</td>\n",
              "      <td>[-1.7112693786621094, 0.5982310175895691, -0.2...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>This rain going dumb, itâs flooding now</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>49</th>\n",
              "      <td>WEATHER ALERT: Severe Thunderstorm Warning inc...</td>\n",
              "      <td>[-0.7861663699150085, 0.22981716692447662, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>WEATHER ALERT: Severe Thunderstorm Warning inc...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-abb9fedd-6897-4672-ad89-18bc9882cda0')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-abb9fedd-6897-4672-ad89-18bc9882cda0 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-abb9fedd-6897-4672-ad89-18bc9882cda0');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-0a628dc7-f697-41a7-a9bf-d06714107c65\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-0a628dc7-f697-41a7-a9bf-d06714107c65')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-0a628dc7-f697-41a7-a9bf-d06714107c65 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 20
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "lVyOE2wV0fw_"
      },
      "source": [
        "# 4. Test the fitted pipe on new example"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 150
        },
        "id": "qdCUg2MR0PD2",
        "outputId": "26791371-6cec-4fc7-cd18-feee3ab9ff33"
      },
      "source": [
        "fitted_pipe.predict(\"All the buildings in the capital were destroyed\")"
      ],
      "execution_count": 21,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "sentence_detector_dl download started this may take some time.\n",
            "Approximate size to download 354.6 KB\n",
            "[OK!]\n",
            "Warning::Spark Session already created, some configs may not take.\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                          sentence  \\\n",
              "0  All the buildings in the capital were destroyed   \n",
              "\n",
              "                sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0  [-0.33511286973953247, 0.3084930181503296, -1....  negative   \n",
              "\n",
              "  sentiment_confidence  \n",
              "0              0.99924  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-283b9aed-bae2-4606-914d-e0ea186e8941\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>sentence</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>All the buildings in the capital were destroyed</td>\n",
              "      <td>[-0.33511286973953247, 0.3084930181503296, -1....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.99924</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-283b9aed-bae2-4606-914d-e0ea186e8941')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-283b9aed-bae2-4606-914d-e0ea186e8941 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-283b9aed-bae2-4606-914d-e0ea186e8941');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 21
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xflpwrVjjBVD"
      },
      "source": [
        "## 5. Configure pipe training parameters"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "UtsAUGTmOTms",
        "outputId": "f3a5243e-8d0b-4d05-c78c-2432e227fb1f"
      },
      "source": [
        "trainable_pipe.print_info()"
      ],
      "execution_count": 22,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The following parameters are configurable for this NLU pipeline (You can copy paste the examples) :\n",
            ">>> component_list['bert_sentence_embeddings@sent_small_bert_L2_128'] has settable params:\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setBatchSize(8)              | Info: Size of every batch | Currently set to : 8\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setEngine('tensorflow')      | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setIsLong(False)             | Info: Use Long type instead of Int type for inputs buffer - Some Bert models require Long instead of Int. | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setMaxSentenceLength(128)    | Info: Max sentence length to process | Currently set to : 128\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setDimension(128)            | Info: Number of embedding dimensions | Currently set to : 128\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setCaseSensitive(False)      | Info: whether to ignore case in tokens for embeddings matching | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setStorageRef('sent_small_bert_L2_128')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L2_128\n",
            ">>> component_list['document_assembler'] has settable params:\n",
            "component_list['document_assembler'].setCleanupMode('shrink')                                  | Info: possible values: disabled, inplace, inplace_full, shrink, shrink_full, each, each_full, delete_full | Currently set to : shrink\n",
            ">>> component_list['sentiment_dl@sent_small_bert_L2_128'] has settable params:\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setEngine('tensorflow')                  | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setThreshold(0.6)                        | Info: The minimum threshold for the final result otheriwse it will be neutral | Currently set to : 0.6\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setThresholdLabel('neutral')             | Info: In case the score is less than threshold, what should be the label. Default is neutral. | Currently set to : neutral\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setStorageRef('sent_small_bert_L2_128')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L2_128\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2GJdDNV9jEIe"
      },
      "source": [
        "## 6. Retrain with new parameters"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "mptfvHx-MMMX",
        "outputId": "57da7cc5-2818-4378-a208-e63a5368ce52"
      },
      "source": [
        "# Train longer!\n",
        "trainable_pipe = nlp.load('train.sentiment')\n",
        "trainable_pipe['trainable_sentiment_dl'].setMaxEpochs(5)\n",
        "fitted_pipe = trainable_pipe.fit(train_df.iloc[:50])\n",
        "# predict with the trainable pipeline on dataset and get predictions\n",
        "preds = fitted_pipe.predict(train_df.iloc[:50],output_level='document')\n",
        "\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))\n",
        "\n",
        "preds"
      ],
      "execution_count": 23,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "sent_small_bert_L2_128 download started this may take some time.\n",
            "Approximate size to download 16.1 MB\n",
            "[OK!]\n",
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.56      1.00      0.72        28\n",
            "    positive       0.00      0.00      0.00        22\n",
            "\n",
            "    accuracy                           0.56        50\n",
            "   macro avg       0.28      0.50      0.36        50\n",
            "weighted avg       0.31      0.56      0.40        50\n",
            "\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                             document  \\\n",
              "0   Arsonist sets cars ablaze at dealership https:...   \n",
              "1   Travis Manawa [about Brandon's group]: I think...   \n",
              "2   If a scientist said if you jump off a cliff yo...   \n",
              "3   #StormBrendon is also bringing high winds, so ...   \n",
              "4   Like , I'm really talking about blending gener...   \n",
              "5   Seriously though... If that defender was taken...   \n",
              "6   Chemical Hazard - Advice for Cobram. For more ...   \n",
              "7   2,400 jobs are at stake should the deal fall t...   \n",
              "8   Western Cape blood stocks down to just four da...   \n",
              "9   Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...   \n",
              "10  BREAKING: Ukrainian President Volodymyr Zelens...   \n",
              "11  Here's what you can learn from the conservativ...   \n",
              "12  Rajneeti News (Stardust: Oldest material on ea...   \n",
              "13  In 2008, Laskar and Gastineau simulated 2500 f...   \n",
              "14  Why are you still calling it a plane crash ð§...   \n",
              "15  Report recieved of a 9 vehicle RTC on M66 betw...   \n",
              "16  ** Cleared ** The vehicles involved in the col...   \n",
              "17  105 is the number to call if you have a power ...   \n",
              "18  Stress is something that affects many of us. I...   \n",
              "19  Re: #AustraliaBushfires, a question for any #f...   \n",
              "20  Enormous exploding sinkhole in China swallows ...   \n",
              "21  This creature whoâs soul is no longer claren...   \n",
              "22  In 70 CE Titus the son of the Roman Emperor Ve...   \n",
              "23  #BREAKING: Trudeau says the 57 Canadians kille...   \n",
              "24  airplane accident answers. The US designated t...   \n",
              "25  Unlike previous State of the nation addresses,...   \n",
              "26  Woodbury takes emergency action to address #wa...   \n",
              "27  Mudslide closes Kailua-bound lane of Pali High...   \n",
              "28  á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...   \n",
              "29  Eduardo Degrano looks at the damage to his hom...   \n",
              "30  darinde...how i wish i could put these in hot ...   \n",
              "31  Earthquake Information No.1 Date and Time: 14 ...   \n",
              "32  âItâs a blight on the country as a whole.â...   \n",
              "33  I don't mind being your enemy if you're an ene...   \n",
              "34  A follow-up to yesterday's Pakistan post: In t...   \n",
              "35  âPassed away.â This euphemistic trash is p...   \n",
              "36  I wonder how many homes could have been saved ...   \n",
              "37  I just zoom it and took ss and feel attack.. H...   \n",
              "38  Human Body Parts Discovered In Bag In Dublin h...   \n",
              "39  It is not just an Australian problem. We need ...   \n",
              "40  If I didn't need my Crutch I would seriously w...   \n",
              "41  But it eventually will have to work without......   \n",
              "42  ... #MAGA5G.LiVEViL+ my recommended read not f...   \n",
              "43  This earlier collision N'bound between J9 Red ...   \n",
              "44           I feel attacked. https://t.co/PrtvRimq6y   \n",
              "45  For the past several months, after imposing a ...   \n",
              "46  Yuck! Looks like she's wearing a body bag. May...   \n",
              "47  Such a loss to and the people of NE Fife. pays...   \n",
              "48          This rain going dumb, itâs flooding now   \n",
              "49  WEATHER ALERT: Severe Thunderstorm Warning inc...   \n",
              "\n",
              "                 sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0   [-0.1667916625738144, 1.0302923917770386, 0.18...  negative   \n",
              "1   [-0.9610550999641418, 0.13062980771064758, -0....  negative   \n",
              "2   [-0.6688402891159058, 0.640354335308075, 0.369...  negative   \n",
              "3   [-1.0540131330490112, 0.8802893757820129, -0.6...  negative   \n",
              "4   [-1.0963889360427856, -0.39644378423690796, 0....  negative   \n",
              "5   [-0.9136804938316345, 0.593141496181488, -0.13...  negative   \n",
              "6   [-0.38091930747032166, 0.6411349177360535, 0.1...  negative   \n",
              "7   [-0.44847720861434937, 0.5910513997077942, -0....  negative   \n",
              "8   [-0.5973049402236938, 0.3307306170463562, -0.1...  negative   \n",
              "9   [-0.5309799313545227, -0.5059896111488342, -0....  negative   \n",
              "10  [-1.1355115175247192, -0.24506860971450806, -0...  negative   \n",
              "11  [-1.1318162679672241, 0.4271548390388489, -0.1...  negative   \n",
              "12  [-0.4446831941604614, -0.11513718217611313, 0....  negative   \n",
              "13  [-0.7734904885292053, -0.19835318624973297, -0...  negative   \n",
              "14  [-0.12437181919813156, 1.112841010093689, 0.27...  negative   \n",
              "15  [-0.38135823607444763, 1.1142768859863281, -0....  negative   \n",
              "16  [-0.2368348389863968, 0.9701917171478271, -0.3...  negative   \n",
              "17  [-0.8241100907325745, 1.1454272270202637, -0.0...  negative   \n",
              "18  [-0.9658268690109253, 0.5662633776664734, -0.2...  negative   \n",
              "19  [-0.6997240781784058, 0.5168095827102661, 0.12...  negative   \n",
              "20  [-0.5793707370758057, -0.18351595103740692, -0...  negative   \n",
              "21  [-0.4663412868976593, 0.04406387358903885, 0.1...  negative   \n",
              "22  [-0.8847564458847046, -0.1676793396472931, -0....  negative   \n",
              "23  [-0.45176926255226135, -0.1339559406042099, -0...  negative   \n",
              "24  [-0.2922760844230652, 0.3953195810317993, -0.1...  negative   \n",
              "25  [-0.8965665698051453, 0.9926007986068726, -0.3...  negative   \n",
              "26  [-0.7830190658569336, 0.8649871349334717, 0.20...  negative   \n",
              "27  [-0.42747634649276733, 0.13894236087799072, -0...  negative   \n",
              "28  [-0.5791727304458618, 0.11972904205322266, 0.4...  negative   \n",
              "29  [-1.1623308658599854, 0.569926917552948, -0.58...  negative   \n",
              "30  [-1.5163923501968384, 0.6165133118629456, -0.5...  negative   \n",
              "31  [-1.085410714149475, -0.15019290149211884, -0....  negative   \n",
              "32  [-0.5412101745605469, 0.611747682094574, -0.00...  negative   \n",
              "33  [-0.6546711325645447, 0.43016937375068665, -0....  negative   \n",
              "34  [-1.091268539428711, -0.17232197523117065, -0....  negative   \n",
              "35  [-1.0350548028945923, 0.04470200464129448, -0....  negative   \n",
              "36  [-0.6520278453826904, 0.6858862042427063, -0.3...  negative   \n",
              "37  [-0.9297969937324524, -0.12180554866790771, 0....  negative   \n",
              "38  [-0.6394882202148438, 0.8264853954315186, 0.34...  negative   \n",
              "39  [-0.7464641332626343, 0.9418659806251526, -0.3...  negative   \n",
              "40  [-1.1001498699188232, 1.0316743850708008, -0.3...  negative   \n",
              "41  [-0.6016444563865662, 0.95436030626297, -0.232...  negative   \n",
              "42  [-0.8835289478302002, 0.3090209364891052, 0.29...  negative   \n",
              "43  [-0.19473275542259216, 0.8363125920295715, 0.0...  negative   \n",
              "44  [-0.4955633580684662, 0.16522228717803955, 0.6...  negative   \n",
              "45  [-0.5843112468719482, 0.04129549860954285, 0.2...  negative   \n",
              "46  [-1.058443307876587, 0.23154138028621674, -0.4...  negative   \n",
              "47  [-0.9249093532562256, -0.045939963310956955, -...  negative   \n",
              "48  [-1.7112693786621094, 0.5982310175895691, -0.2...  negative   \n",
              "49  [-0.7861663699150085, 0.22981716692447662, -0....  negative   \n",
              "\n",
              "   sentiment_confidence                                               text  \\\n",
              "0                   0.0  Arsonist sets cars ablaze at dealership https:...   \n",
              "1                   8.0  Travis Manawa [about Brandon's group]: I think...   \n",
              "2                   3.0  If a scientist said if you jump off a cliff yo...   \n",
              "3                   8.0  #StormBrendon is also bringing high winds, so ...   \n",
              "4                   1.0  Like , I'm really talking about blending gener...   \n",
              "5                   5.0  Seriously though... If that defender was taken...   \n",
              "6                   9.0  Chemical Hazard - Advice for Cobram. For more ...   \n",
              "7                   6.0  2,400 jobs are at stake should the deal fall t...   \n",
              "8                   0.0  Western Cape blood stocks down to just four da...   \n",
              "9                   0.0  Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...   \n",
              "10                  0.0  BREAKING: Ukrainian President Volodymyr Zelens...   \n",
              "11                  1.0  Here's what you can learn from the conservativ...   \n",
              "12                  0.0  Rajneeti News (Stardust: Oldest material on ea...   \n",
              "13                  0.0  In 2008, Laskar and Gastineau simulated 2500 f...   \n",
              "14                  4.0  Why are you still calling it a plane crash ð§...   \n",
              "15                  0.0  Report recieved of a 9 vehicle RTC on M66 betw...   \n",
              "16                  0.0  ** Cleared ** The vehicles involved in the col...   \n",
              "17                  6.0  105 is the number to call if you have a power ...   \n",
              "18                  2.0  Stress is something that affects many of us. I...   \n",
              "19                  0.0  Re: #AustraliaBushfires, a question for any #f...   \n",
              "20                  0.0  Enormous exploding sinkhole in China swallows ...   \n",
              "21                  3.0  This creature whoâs soul is no longer claren...   \n",
              "22                  0.0  In 70 CE Titus the son of the Roman Emperor Ve...   \n",
              "23                  0.0  #BREAKING: Trudeau says the 57 Canadians kille...   \n",
              "24                  0.0  airplane accident answers. The US designated t...   \n",
              "25                  3.0  Unlike previous State of the nation addresses,...   \n",
              "26                  0.0  Woodbury takes emergency action to address #wa...   \n",
              "27                  0.0  Mudslide closes Kailua-bound lane of Pali High...   \n",
              "28                  2.0  á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...   \n",
              "29                  7.0  Eduardo Degrano looks at the damage to his hom...   \n",
              "30                  3.0  darinde...how i wish i could put these in hot ...   \n",
              "31                  0.0  Earthquake Information No.1 Date and Time: 14 ...   \n",
              "32                  6.0  âItâs a blight on the country as a whole.â...   \n",
              "33                  7.0  I don't mind being your enemy if you're an ene...   \n",
              "34                  0.0  A follow-up to yesterday's Pakistan post: In t...   \n",
              "35                  2.0  âPassed away.â This euphemistic trash is p...   \n",
              "36                  4.0  I wonder how many homes could have been saved ...   \n",
              "37                  1.0  I just zoom it and took ss and feel attack.. H...   \n",
              "38                  0.0  Human Body Parts Discovered In Bag In Dublin h...   \n",
              "39                  5.0  It is not just an Australian problem. We need ...   \n",
              "40                  7.0  If I didn't need my Crutch I would seriously w...   \n",
              "41                  3.0  But it eventually will have to work without......   \n",
              "42                  2.0  ... #MAGA5G.LiVEViL+ my recommended read not f...   \n",
              "43                  0.0  This earlier collision N'bound between J9 Red ...   \n",
              "44                  6.0           I feel attacked. https://t.co/PrtvRimq6y   \n",
              "45                  0.0  For the past several months, after imposing a ...   \n",
              "46                  2.0  Yuck! Looks like she's wearing a body bag. May...   \n",
              "47                  5.0  Such a loss to and the people of NE Fife. pays...   \n",
              "48                  2.0          This rain going dumb, itâs flooding now   \n",
              "49                  0.0  WEATHER ALERT: Severe Thunderstorm Warning inc...   \n",
              "\n",
              "           y  \n",
              "0   positive  \n",
              "1   negative  \n",
              "2   negative  \n",
              "3   positive  \n",
              "4   negative  \n",
              "5   positive  \n",
              "6   positive  \n",
              "7   negative  \n",
              "8   negative  \n",
              "9   positive  \n",
              "10  positive  \n",
              "11  negative  \n",
              "12  negative  \n",
              "13  negative  \n",
              "14  negative  \n",
              "15  positive  \n",
              "16  positive  \n",
              "17  positive  \n",
              "18  negative  \n",
              "19  negative  \n",
              "20  positive  \n",
              "21  negative  \n",
              "22  positive  \n",
              "23  positive  \n",
              "24  negative  \n",
              "25  negative  \n",
              "26  positive  \n",
              "27  positive  \n",
              "28  negative  \n",
              "29  negative  \n",
              "30  negative  \n",
              "31  positive  \n",
              "32  negative  \n",
              "33  negative  \n",
              "34  positive  \n",
              "35  negative  \n",
              "36  negative  \n",
              "37  negative  \n",
              "38  positive  \n",
              "39  negative  \n",
              "40  positive  \n",
              "41  negative  \n",
              "42  negative  \n",
              "43  positive  \n",
              "44  negative  \n",
              "45  positive  \n",
              "46  negative  \n",
              "47  negative  \n",
              "48  positive  \n",
              "49  positive  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-1077943d-5802-472b-919a-3bde853a70da\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>[-0.1667916625738144, 1.0302923917770386, 0.18...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Arsonist sets cars ablaze at dealership https:...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Travis Manawa [about Brandon's group]: I think...</td>\n",
              "      <td>[-0.9610550999641418, 0.13062980771064758, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>Travis Manawa [about Brandon's group]: I think...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>If a scientist said if you jump off a cliff yo...</td>\n",
              "      <td>[-0.6688402891159058, 0.640354335308075, 0.369...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>If a scientist said if you jump off a cliff yo...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>#StormBrendon is also bringing high winds, so ...</td>\n",
              "      <td>[-1.0540131330490112, 0.8802893757820129, -0.6...</td>\n",
              "      <td>negative</td>\n",
              "      <td>8.0</td>\n",
              "      <td>#StormBrendon is also bringing high winds, so ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Like , I'm really talking about blending gener...</td>\n",
              "      <td>[-1.0963889360427856, -0.39644378423690796, 0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Like , I'm really talking about blending gener...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>Seriously though... If that defender was taken...</td>\n",
              "      <td>[-0.9136804938316345, 0.593141496181488, -0.13...</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Seriously though... If that defender was taken...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>Chemical Hazard - Advice for Cobram. For more ...</td>\n",
              "      <td>[-0.38091930747032166, 0.6411349177360535, 0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>9.0</td>\n",
              "      <td>Chemical Hazard - Advice for Cobram. For more ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>2,400 jobs are at stake should the deal fall t...</td>\n",
              "      <td>[-0.44847720861434937, 0.5910513997077942, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>6.0</td>\n",
              "      <td>2,400 jobs are at stake should the deal fall t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>Western Cape blood stocks down to just four da...</td>\n",
              "      <td>[-0.5973049402236938, 0.3307306170463562, -0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Western Cape blood stocks down to just four da...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...</td>\n",
              "      <td>[-0.5309799313545227, -0.5059896111488342, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Last night in Sweden ð¸ðª 2 BOMBINGS. - Th...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>10</th>\n",
              "      <td>BREAKING: Ukrainian President Volodymyr Zelens...</td>\n",
              "      <td>[-1.1355115175247192, -0.24506860971450806, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>BREAKING: Ukrainian President Volodymyr Zelens...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11</th>\n",
              "      <td>Here's what you can learn from the conservativ...</td>\n",
              "      <td>[-1.1318162679672241, 0.4271548390388489, -0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Here's what you can learn from the conservativ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12</th>\n",
              "      <td>Rajneeti News (Stardust: Oldest material on ea...</td>\n",
              "      <td>[-0.4446831941604614, -0.11513718217611313, 0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Rajneeti News (Stardust: Oldest material on ea...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>13</th>\n",
              "      <td>In 2008, Laskar and Gastineau simulated 2500 f...</td>\n",
              "      <td>[-0.7734904885292053, -0.19835318624973297, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>In 2008, Laskar and Gastineau simulated 2500 f...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14</th>\n",
              "      <td>Why are you still calling it a plane crash ð§...</td>\n",
              "      <td>[-0.12437181919813156, 1.112841010093689, 0.27...</td>\n",
              "      <td>negative</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Why are you still calling it a plane crash ð§...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>15</th>\n",
              "      <td>Report recieved of a 9 vehicle RTC on M66 betw...</td>\n",
              "      <td>[-0.38135823607444763, 1.1142768859863281, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Report recieved of a 9 vehicle RTC on M66 betw...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>16</th>\n",
              "      <td>** Cleared ** The vehicles involved in the col...</td>\n",
              "      <td>[-0.2368348389863968, 0.9701917171478271, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>** Cleared ** The vehicles involved in the col...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>17</th>\n",
              "      <td>105 is the number to call if you have a power ...</td>\n",
              "      <td>[-0.8241100907325745, 1.1454272270202637, -0.0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>6.0</td>\n",
              "      <td>105 is the number to call if you have a power ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>18</th>\n",
              "      <td>Stress is something that affects many of us. I...</td>\n",
              "      <td>[-0.9658268690109253, 0.5662633776664734, -0.2...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Stress is something that affects many of us. I...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19</th>\n",
              "      <td>Re: #AustraliaBushfires, a question for any #f...</td>\n",
              "      <td>[-0.6997240781784058, 0.5168095827102661, 0.12...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Re: #AustraliaBushfires, a question for any #f...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>20</th>\n",
              "      <td>Enormous exploding sinkhole in China swallows ...</td>\n",
              "      <td>[-0.5793707370758057, -0.18351595103740692, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Enormous exploding sinkhole in China swallows ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>21</th>\n",
              "      <td>This creature whoâs soul is no longer claren...</td>\n",
              "      <td>[-0.4663412868976593, 0.04406387358903885, 0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>This creature whoâs soul is no longer claren...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>22</th>\n",
              "      <td>In 70 CE Titus the son of the Roman Emperor Ve...</td>\n",
              "      <td>[-0.8847564458847046, -0.1676793396472931, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>In 70 CE Titus the son of the Roman Emperor Ve...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>23</th>\n",
              "      <td>#BREAKING: Trudeau says the 57 Canadians kille...</td>\n",
              "      <td>[-0.45176926255226135, -0.1339559406042099, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>#BREAKING: Trudeau says the 57 Canadians kille...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>24</th>\n",
              "      <td>airplane accident answers. The US designated t...</td>\n",
              "      <td>[-0.2922760844230652, 0.3953195810317993, -0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>airplane accident answers. The US designated t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>25</th>\n",
              "      <td>Unlike previous State of the nation addresses,...</td>\n",
              "      <td>[-0.8965665698051453, 0.9926007986068726, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Unlike previous State of the nation addresses,...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>26</th>\n",
              "      <td>Woodbury takes emergency action to address #wa...</td>\n",
              "      <td>[-0.7830190658569336, 0.8649871349334717, 0.20...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Woodbury takes emergency action to address #wa...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>27</th>\n",
              "      <td>Mudslide closes Kailua-bound lane of Pali High...</td>\n",
              "      <td>[-0.42747634649276733, 0.13894236087799072, -0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Mudslide closes Kailua-bound lane of Pali High...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>28</th>\n",
              "      <td>á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...</td>\n",
              "      <td>[-0.5791727304458618, 0.11972904205322266, 0.4...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>á´Êá´Êá´É´s... á´Êá´Ê'Êá´ É´á´á´ ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>29</th>\n",
              "      <td>Eduardo Degrano looks at the damage to his hom...</td>\n",
              "      <td>[-1.1623308658599854, 0.569926917552948, -0.58...</td>\n",
              "      <td>negative</td>\n",
              "      <td>7.0</td>\n",
              "      <td>Eduardo Degrano looks at the damage to his hom...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>30</th>\n",
              "      <td>darinde...how i wish i could put these in hot ...</td>\n",
              "      <td>[-1.5163923501968384, 0.6165133118629456, -0.5...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>darinde...how i wish i could put these in hot ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>31</th>\n",
              "      <td>Earthquake Information No.1 Date and Time: 14 ...</td>\n",
              "      <td>[-1.085410714149475, -0.15019290149211884, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Earthquake Information No.1 Date and Time: 14 ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>32</th>\n",
              "      <td>âItâs a blight on the country as a whole.â...</td>\n",
              "      <td>[-0.5412101745605469, 0.611747682094574, -0.00...</td>\n",
              "      <td>negative</td>\n",
              "      <td>6.0</td>\n",
              "      <td>âItâs a blight on the country as a whole.â...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>33</th>\n",
              "      <td>I don't mind being your enemy if you're an ene...</td>\n",
              "      <td>[-0.6546711325645447, 0.43016937375068665, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>7.0</td>\n",
              "      <td>I don't mind being your enemy if you're an ene...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>34</th>\n",
              "      <td>A follow-up to yesterday's Pakistan post: In t...</td>\n",
              "      <td>[-1.091268539428711, -0.17232197523117065, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>A follow-up to yesterday's Pakistan post: In t...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>35</th>\n",
              "      <td>âPassed away.â This euphemistic trash is p...</td>\n",
              "      <td>[-1.0350548028945923, 0.04470200464129448, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>âPassed away.â This euphemistic trash is p...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>36</th>\n",
              "      <td>I wonder how many homes could have been saved ...</td>\n",
              "      <td>[-0.6520278453826904, 0.6858862042427063, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>4.0</td>\n",
              "      <td>I wonder how many homes could have been saved ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>37</th>\n",
              "      <td>I just zoom it and took ss and feel attack.. H...</td>\n",
              "      <td>[-0.9297969937324524, -0.12180554866790771, 0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>1.0</td>\n",
              "      <td>I just zoom it and took ss and feel attack.. H...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>38</th>\n",
              "      <td>Human Body Parts Discovered In Bag In Dublin h...</td>\n",
              "      <td>[-0.6394882202148438, 0.8264853954315186, 0.34...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>Human Body Parts Discovered In Bag In Dublin h...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>39</th>\n",
              "      <td>It is not just an Australian problem. We need ...</td>\n",
              "      <td>[-0.7464641332626343, 0.9418659806251526, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>It is not just an Australian problem. We need ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>40</th>\n",
              "      <td>If I didn't need my Crutch I would seriously w...</td>\n",
              "      <td>[-1.1001498699188232, 1.0316743850708008, -0.3...</td>\n",
              "      <td>negative</td>\n",
              "      <td>7.0</td>\n",
              "      <td>If I didn't need my Crutch I would seriously w...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>41</th>\n",
              "      <td>But it eventually will have to work without......</td>\n",
              "      <td>[-0.6016444563865662, 0.95436030626297, -0.232...</td>\n",
              "      <td>negative</td>\n",
              "      <td>3.0</td>\n",
              "      <td>But it eventually will have to work without......</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>42</th>\n",
              "      <td>... #MAGA5G.LiVEViL+ my recommended read not f...</td>\n",
              "      <td>[-0.8835289478302002, 0.3090209364891052, 0.29...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>... #MAGA5G.LiVEViL+ my recommended read not f...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>43</th>\n",
              "      <td>This earlier collision N'bound between J9 Red ...</td>\n",
              "      <td>[-0.19473275542259216, 0.8363125920295715, 0.0...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>This earlier collision N'bound between J9 Red ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>44</th>\n",
              "      <td>I feel attacked. https://t.co/PrtvRimq6y</td>\n",
              "      <td>[-0.4955633580684662, 0.16522228717803955, 0.6...</td>\n",
              "      <td>negative</td>\n",
              "      <td>6.0</td>\n",
              "      <td>I feel attacked. https://t.co/PrtvRimq6y</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>45</th>\n",
              "      <td>For the past several months, after imposing a ...</td>\n",
              "      <td>[-0.5843112468719482, 0.04129549860954285, 0.2...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>For the past several months, after imposing a ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>46</th>\n",
              "      <td>Yuck! Looks like she's wearing a body bag. May...</td>\n",
              "      <td>[-1.058443307876587, 0.23154138028621674, -0.4...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Yuck! Looks like she's wearing a body bag. May...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>47</th>\n",
              "      <td>Such a loss to and the people of NE Fife. pays...</td>\n",
              "      <td>[-0.9249093532562256, -0.045939963310956955, -...</td>\n",
              "      <td>negative</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Such a loss to and the people of NE Fife. pays...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>48</th>\n",
              "      <td>This rain going dumb, itâs flooding now</td>\n",
              "      <td>[-1.7112693786621094, 0.5982310175895691, -0.2...</td>\n",
              "      <td>negative</td>\n",
              "      <td>2.0</td>\n",
              "      <td>This rain going dumb, itâs flooding now</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>49</th>\n",
              "      <td>WEATHER ALERT: Severe Thunderstorm Warning inc...</td>\n",
              "      <td>[-0.7861663699150085, 0.22981716692447662, -0....</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "      <td>WEATHER ALERT: Severe Thunderstorm Warning inc...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1077943d-5802-472b-919a-3bde853a70da')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-1077943d-5802-472b-919a-3bde853a70da button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-1077943d-5802-472b-919a-3bde853a70da');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-c11892ae-7059-40a3-9eb8-bd1501af6ace\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-c11892ae-7059-40a3-9eb8-bd1501af6ace')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-c11892ae-7059-40a3-9eb8-bd1501af6ace button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 23
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qFoT-s1MjTSS"
      },
      "source": [
        "# 7. Try training with different Embeddings"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "nxWFzQOhjWC8",
        "outputId": "a05a0ef1-4d3e-4c7f-87b7-3ff1849608a3"
      },
      "source": [
        "# We can use nlu.print_components(action='embed_sentence') to see every possibler sentence embedding we could use. Lets use bert!\n",
        "nlp.nlu.print_components(action='embed_sentence')"
      ],
      "execution_count": 24,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "For language <am> NLU provides the following Models : \n",
            "nlu.load('am.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_amharic\n",
            "For language <de> NLU provides the following Models : \n",
            "nlu.load('de.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "For language <el> NLU provides the following Models : \n",
            "nlu.load('el.embed_sentence.bert.base_uncased') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "For language <en> NLU provides the following Models : \n",
            "nlu.load('en.embed_sentence') returns Spark NLP model_anno_obj tfhub_use\n",
            "nlu.load('en.embed_sentence.albert') returns Spark NLP model_anno_obj albert_base_uncased\n",
            "nlu.load('en.embed_sentence.bert') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "nlu.load('en.embed_sentence.bert.base_uncased_legal') returns Spark NLP model_anno_obj sent_bert_base_uncased_legal\n",
            "nlu.load('en.embed_sentence.bert.finetuned') returns Spark NLP model_anno_obj sbert_setfit_finetuned_financial_text_classification\n",
            "nlu.load('en.embed_sentence.bert.pubmed') returns Spark NLP model_anno_obj sent_bert_pubmed\n",
            "nlu.load('en.embed_sentence.bert.pubmed_squad2') returns Spark NLP model_anno_obj sent_bert_pubmed_squad2\n",
            "nlu.load('en.embed_sentence.bert.wiki_books') returns Spark NLP model_anno_obj sent_bert_wiki_books\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_mnli') returns Spark NLP model_anno_obj sent_bert_wiki_books_mnli\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_qnli') returns Spark NLP model_anno_obj sent_bert_wiki_books_qnli\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_qqp') returns Spark NLP model_anno_obj sent_bert_wiki_books_qqp\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_squad2') returns Spark NLP model_anno_obj sent_bert_wiki_books_squad2\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_sst2') returns Spark NLP model_anno_obj sent_bert_wiki_books_sst2\n",
            "nlu.load('en.embed_sentence.bert_base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "nlu.load('en.embed_sentence.bert_base_uncased') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "nlu.load('en.embed_sentence.bert_large_cased') returns Spark NLP model_anno_obj sent_bert_large_cased\n",
            "nlu.load('en.embed_sentence.bert_large_uncased') returns Spark NLP model_anno_obj sent_bert_large_uncased\n",
            "nlu.load('en.embed_sentence.bert_use_cmlm_en_base') returns Spark NLP model_anno_obj sent_bert_use_cmlm_en_base\n",
            "nlu.load('en.embed_sentence.bert_use_cmlm_en_large') returns Spark NLP model_anno_obj sent_bert_use_cmlm_en_large\n",
            "nlu.load('en.embed_sentence.biobert.clinical_base_cased') returns Spark NLP model_anno_obj sent_biobert_clinical_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.discharge_base_cased') returns Spark NLP model_anno_obj sent_biobert_discharge_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.pmc_base_cased') returns Spark NLP model_anno_obj sent_biobert_pmc_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.pubmed_base_cased') returns Spark NLP model_anno_obj sent_biobert_pubmed_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.pubmed_large_cased') returns Spark NLP model_anno_obj sent_biobert_pubmed_large_cased\n",
            "nlu.load('en.embed_sentence.biobert.pubmed_pmc_base_cased') returns Spark NLP model_anno_obj sent_biobert_pubmed_pmc_base_cased\n",
            "nlu.load('en.embed_sentence.covidbert.large_uncased') returns Spark NLP model_anno_obj sent_covidbert_large_uncased\n",
            "nlu.load('en.embed_sentence.distil_roberta.distilled_base') returns Spark NLP model_anno_obj sent_distilroberta_base\n",
            "nlu.load('en.embed_sentence.doc2vec') returns Spark NLP model_anno_obj doc2vec_gigaword_300\n",
            "nlu.load('en.embed_sentence.doc2vec.gigaword_300') returns Spark NLP model_anno_obj doc2vec_gigaword_300\n",
            "nlu.load('en.embed_sentence.doc2vec.gigaword_wiki_300') returns Spark NLP model_anno_obj doc2vec_gigaword_wiki_300\n",
            "nlu.load('en.embed_sentence.electra') returns Spark NLP model_anno_obj sent_electra_small_uncased\n",
            "nlu.load('en.embed_sentence.electra_base_uncased') returns Spark NLP model_anno_obj sent_electra_base_uncased\n",
            "nlu.load('en.embed_sentence.electra_large_uncased') returns Spark NLP model_anno_obj sent_electra_large_uncased\n",
            "nlu.load('en.embed_sentence.electra_small_uncased') returns Spark NLP model_anno_obj sent_electra_small_uncased\n",
            "nlu.load('en.embed_sentence.roberta.base') returns Spark NLP model_anno_obj sent_roberta_base\n",
            "nlu.load('en.embed_sentence.roberta.large') returns Spark NLP model_anno_obj sent_roberta_large\n",
            "nlu.load('en.embed_sentence.small_bert_L10_128') returns Spark NLP model_anno_obj sent_small_bert_L10_128\n",
            "nlu.load('en.embed_sentence.small_bert_L10_256') returns Spark NLP model_anno_obj sent_small_bert_L10_256\n",
            "nlu.load('en.embed_sentence.small_bert_L10_512') returns Spark NLP model_anno_obj sent_small_bert_L10_512\n",
            "nlu.load('en.embed_sentence.small_bert_L10_768') returns Spark NLP model_anno_obj sent_small_bert_L10_768\n",
            "nlu.load('en.embed_sentence.small_bert_L12_128') returns Spark NLP model_anno_obj sent_small_bert_L12_128\n",
            "nlu.load('en.embed_sentence.small_bert_L12_256') returns Spark NLP model_anno_obj sent_small_bert_L12_256\n",
            "nlu.load('en.embed_sentence.small_bert_L12_512') returns Spark NLP model_anno_obj sent_small_bert_L12_512\n",
            "nlu.load('en.embed_sentence.small_bert_L12_768') returns Spark NLP model_anno_obj sent_small_bert_L12_768\n",
            "nlu.load('en.embed_sentence.small_bert_L2_128') returns Spark NLP model_anno_obj sent_small_bert_L2_128\n",
            "nlu.load('en.embed_sentence.small_bert_L2_256') returns Spark NLP model_anno_obj sent_small_bert_L2_256\n",
            "nlu.load('en.embed_sentence.small_bert_L2_512') returns Spark NLP model_anno_obj sent_small_bert_L2_512\n",
            "nlu.load('en.embed_sentence.small_bert_L2_768') returns Spark NLP model_anno_obj sent_small_bert_L2_768\n",
            "nlu.load('en.embed_sentence.small_bert_L4_128') returns Spark NLP model_anno_obj sent_small_bert_L4_128\n",
            "nlu.load('en.embed_sentence.small_bert_L4_256') returns Spark NLP model_anno_obj sent_small_bert_L4_256\n",
            "nlu.load('en.embed_sentence.small_bert_L4_512') returns Spark NLP model_anno_obj sent_small_bert_L4_512\n",
            "nlu.load('en.embed_sentence.small_bert_L4_768') returns Spark NLP model_anno_obj sent_small_bert_L4_768\n",
            "nlu.load('en.embed_sentence.small_bert_L6_128') returns Spark NLP model_anno_obj sent_small_bert_L6_128\n",
            "nlu.load('en.embed_sentence.small_bert_L6_256') returns Spark NLP model_anno_obj sent_small_bert_L6_256\n",
            "nlu.load('en.embed_sentence.small_bert_L6_512') returns Spark NLP model_anno_obj sent_small_bert_L6_512\n",
            "nlu.load('en.embed_sentence.small_bert_L6_768') returns Spark NLP model_anno_obj sent_small_bert_L6_768\n",
            "nlu.load('en.embed_sentence.small_bert_L8_128') returns Spark NLP model_anno_obj sent_small_bert_L8_128\n",
            "nlu.load('en.embed_sentence.small_bert_L8_256') returns Spark NLP model_anno_obj sent_small_bert_L8_256\n",
            "nlu.load('en.embed_sentence.small_bert_L8_512') returns Spark NLP model_anno_obj sent_small_bert_L8_512\n",
            "nlu.load('en.embed_sentence.small_bert_L8_768') returns Spark NLP model_anno_obj sent_small_bert_L8_768\n",
            "nlu.load('en.embed_sentence.tfhub_use') returns Spark NLP model_anno_obj tfhub_use\n",
            "nlu.load('en.embed_sentence.tfhub_use.lg') returns Spark NLP model_anno_obj tfhub_use_lg\n",
            "nlu.load('en.embed_sentence.use') returns Spark NLP model_anno_obj tfhub_use\n",
            "nlu.load('en.embed_sentence.use.lg') returns Spark NLP model_anno_obj tfhub_use_lg\n",
            "For language <es> NLU provides the following Models : \n",
            "nlu.load('es.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "nlu.load('es.embed_sentence.bert.base_uncased') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "For language <fi> NLU provides the following Models : \n",
            "nlu.load('fi.embed_sentence.bert') returns Spark NLP model_anno_obj bert_base_finnish_uncased\n",
            "nlu.load('fi.embed_sentence.bert.cased') returns Spark NLP model_anno_obj bert_base_finnish_cased\n",
            "nlu.load('fi.embed_sentence.bert.uncased') returns Spark NLP model_anno_obj bert_base_finnish_uncased\n",
            "For language <ha> NLU provides the following Models : \n",
            "nlu.load('ha.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_hausa\n",
            "For language <ig> NLU provides the following Models : \n",
            "nlu.load('ig.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_igbo\n",
            "For language <lg> NLU provides the following Models : \n",
            "nlu.load('lg.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_luganda\n",
            "For language <nl> NLU provides the following Models : \n",
            "nlu.load('nl.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "For language <pcm> NLU provides the following Models : \n",
            "nlu.load('pcm.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_naija\n",
            "For language <pt> NLU provides the following Models : \n",
            "nlu.load('pt.embed_sentence.bert.base_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_base_tsdae_sts\n",
            "nlu.load('pt.embed_sentence.bert.cased_large_legal') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.1\n",
            "nlu.load('pt.embed_sentence.bert.large_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_gpl_sts\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.10.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.10\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.2.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.2\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.3.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.3\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.4.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.4\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.5.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.5\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.7.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.7\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.8.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.8\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.9.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.9\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v1.0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v1.0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_gpl_nli_sts_v0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_gpl_nli_sts_v0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_gpl_nli_sts_v1.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_gpl_nli_sts_v1\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_nli_sts_v0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_nli_sts_v0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_nli_sts_v1.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_nli_sts_v1\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_sts_v0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_sts_v0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_sts_v1.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_sts_v1\n",
            "nlu.load('pt.embed_sentence.bert.v2_base_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_base_ma_v2\n",
            "nlu.load('pt.embed_sentence.bert.v2_large_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_sts_v2\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.assin.base.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_base_ma\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.assin2.base.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_base\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_sts_by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_sts_ma.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large_ma\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_sts_ma_v3.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large_ma_v3\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_tsdae_sts.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_sts\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_tsdae_sts_v4.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_sts_v4\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_tsdae_v4_gpl_sts.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_v4_gpl_sts\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.v2_large_sts_v2.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large_v2\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.v2_large_v2_sts.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_v2_sts\n",
            "For language <rw> NLU provides the following Models : \n",
            "nlu.load('rw.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_kinyarwanda\n",
            "For language <sv> NLU provides the following Models : \n",
            "nlu.load('sv.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "For language <sw> NLU provides the following Models : \n",
            "nlu.load('sw.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_swahili\n",
            "For language <wo> NLU provides the following Models : \n",
            "nlu.load('wo.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_wolof\n",
            "For language <xx> NLU provides the following Models : \n",
            "nlu.load('xx.embed_sentence') returns Spark NLP model_anno_obj sent_bert_multi_cased\n",
            "nlu.load('xx.embed_sentence.bert') returns Spark NLP model_anno_obj sent_bert_multi_cased\n",
            "nlu.load('xx.embed_sentence.bert.cased') returns Spark NLP model_anno_obj sent_bert_multi_cased\n",
            "nlu.load('xx.embed_sentence.bert.muril') returns Spark NLP model_anno_obj sent_bert_muril\n",
            "nlu.load('xx.embed_sentence.bert_use_cmlm_multi_base') returns Spark NLP model_anno_obj sent_bert_use_cmlm_multi_base\n",
            "nlu.load('xx.embed_sentence.bert_use_cmlm_multi_base_br') returns Spark NLP model_anno_obj sent_bert_use_cmlm_multi_base_br\n",
            "nlu.load('xx.embed_sentence.labse') returns Spark NLP model_anno_obj labse\n",
            "nlu.load('xx.embed_sentence.xlm_roberta.base') returns Spark NLP model_anno_obj sent_xlm_roberta_base\n",
            "For language <yo> NLU provides the following Models : \n",
            "nlu.load('yo.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_yoruba\n",
            "For language <zh> NLU provides the following Models : \n",
            "nlu.load('zh.embed_sentence.bert') returns Spark NLP model_anno_obj sbert_chinese_qmc_finance_v1\n",
            "nlu.load('zh.embed_sentence.bert.distilled') returns Spark NLP model_anno_obj sbert_chinese_qmc_finance_v1_distill\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "IKK_Ii_gjJfF",
        "outputId": "ea0aed1f-ffd4-4e0c-f85d-d977fbecdcb0"
      },
      "source": [
        "trainable_pipe = nlp.load('en.embed_sentence.small_bert_L12_768 train.sentiment')\n",
        "# We need to train longer and user smaller LR for NON-USE based sentence embeddings usually\n",
        "# We could tune the hyperparameters further with hyperparameter tuning methods like gridsearch\n",
        "# Also longer training gives more accuracy\n",
        "trainable_pipe['trainable_sentiment_dl'].setMaxEpochs(120)\n",
        "trainable_pipe['trainable_sentiment_dl'].setLr(0.0005)\n",
        "fitted_pipe = trainable_pipe.fit(train_df)\n",
        "# predict with the trainable pipeline on dataset and get predictions\n",
        "preds = fitted_pipe.predict(train_df,output_level='document')\n",
        "\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))\n",
        "\n",
        "#preds"
      ],
      "execution_count": 25,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "sent_small_bert_L12_768 download started this may take some time.\n",
            "Approximate size to download 392.9 MB\n",
            "[OK!]\n",
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.88      0.85      0.86      1203\n",
            "     neutral       0.00      0.00      0.00         0\n",
            "    positive       0.88      0.84      0.86      1197\n",
            "\n",
            "    accuracy                           0.85      2400\n",
            "   macro avg       0.59      0.56      0.58      2400\n",
            "weighted avg       0.88      0.85      0.86      2400\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_1jxw3GnVGlI"
      },
      "source": [
        "# 7.1 evaluate on Test Data"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Fxx4yNkNVGFl",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "33633053-c610-4438-cced-15052ff15ffa"
      },
      "source": [
        "preds = fitted_pipe.predict(test_df,output_level='document')\n",
        "\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))"
      ],
      "execution_count": 26,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.85      0.83      0.84       297\n",
            "     neutral       0.00      0.00      0.00         0\n",
            "    positive       0.85      0.81      0.83       303\n",
            "\n",
            "    accuracy                           0.82       600\n",
            "   macro avg       0.57      0.55      0.56       600\n",
            "weighted avg       0.85      0.82      0.84       600\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2BB-NwZUoHSe"
      },
      "source": [
        "# 8. Lets save the model"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "eLex095goHwm"
      },
      "source": [
        "stored_model_path = './models/classifier_dl_trained'\n",
        "fitted_pipe.save(stored_model_path)"
      ],
      "execution_count": 27,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "e_b2DPd4rCiU"
      },
      "source": [
        "# 9. Lets load the model from HDD.\n",
        "This makes Offlien NLU usage possible!   \n",
        "You need to call nlu.load(path=path_to_the_pipe) to load a model/pipeline from disk."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 133
        },
        "id": "SO4uz45MoRgp",
        "outputId": "e9b8ab40-ee03-47b2-de2b-99a0cdb54b5b"
      },
      "source": [
        "hdd_pipe = nlp.load(path=stored_model_path)\n",
        "\n",
        "preds = hdd_pipe.predict('All the buildings in the capital were destroyed')\n",
        "preds"
      ],
      "execution_count": 28,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                          document  \\\n",
              "0  All the buildings in the capital were destroyed   \n",
              "\n",
              "                        sentence_embedding_from_disk sentiment  \\\n",
              "0  [-0.39346593618392944, 0.33815115690231323, -0...  positive   \n",
              "\n",
              "  sentiment_confidence  \n",
              "0                  0.0  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-4aebee7d-3d99-4bc7-8052-9bf5f8eab8f5\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_from_disk</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>All the buildings in the capital were destroyed</td>\n",
              "      <td>[-0.39346593618392944, 0.33815115690231323, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-4aebee7d-3d99-4bc7-8052-9bf5f8eab8f5')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-4aebee7d-3d99-4bc7-8052-9bf5f8eab8f5 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-4aebee7d-3d99-4bc7-8052-9bf5f8eab8f5');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 28
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "e0CVlkk9v6Qi",
        "outputId": "adae61bf-6000-4e21-f24c-d8a547449cd1"
      },
      "source": [
        "hdd_pipe.print_info()"
      ],
      "execution_count": 29,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The following parameters are configurable for this NLU pipeline (You can copy paste the examples) :\n",
            ">>> component_list['document_assembler'] has settable params:\n",
            "component_list['document_assembler'].setCleanupMode('shrink')                                    | Info: possible values: disabled, inplace, inplace_full, shrink, shrink_full, each, each_full, delete_full | Currently set to : shrink\n",
            ">>> component_list['bert_sentence_embeddings@sent_small_bert_L12_768'] has settable params:\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setBatchSize(8)               | Info: Size of every batch | Currently set to : 8\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setCaseSensitive(False)       | Info: whether to ignore case in tokens for embeddings matching | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setDimension(768)             | Info: Number of embedding dimensions | Currently set to : 768\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setMaxSentenceLength(128)     | Info: Max sentence length to process | Currently set to : 128\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setEngine('tensorflow')       | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setIsLong(False)              | Info: Use Long type instead of Int type for inputs buffer - Some Bert models require Long instead of Int. | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setStorageRef('sent_small_bert_L12_768')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L12_768\n",
            ">>> component_list['sentiment_dl@sent_small_bert_L12_768'] has settable params:\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setThreshold(0.6)                         | Info: The minimum threshold for the final result otheriwse it will be neutral | Currently set to : 0.6\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setThresholdLabel('neutral')              | Info: In case the score is less than threshold, what should be the label. Default is neutral. | Currently set to : neutral\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setEngine('tensorflow')                   | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setClasses(['positive', 'negative'])      | Info: get the tags used to trained this SentimentDLModel | Currently set to : ['positive', 'negative']\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setStorageRef('sent_small_bert_L12_768')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L12_768\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "F_mfqyyyKGkV"
      },
      "source": [],
      "execution_count": null,
      "outputs": []
    }
  ]
}